/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;
import Entity.View_Classification;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Dat-masuto
 */
public class Classification extends AbstractTableModel{

    private ArrayList<View_Classification> classifications;
    private final String columnsName[] = {"Code", "Name", "Quantity of Vacanies", "Quantity of Jobseeker"};
    private final Class columnsClass[] = {Integer.class, String.class, Integer.class, Integer.class};

    public Classification(ArrayList<View_Classification> classifications) {
        this.classifications = classifications;
    }



     public int getRowCount() {
        return classifications.toArray().length;
    }

    public int getColumnCount() {
        return columnsName.length;
    }

     public Object getValueAt(int rowIndex, int columnIndex) {
        switch (columnIndex) {
            case 0:
                return classifications.get(rowIndex).getCode();

            case 1:
                return classifications.get(rowIndex).getName();

            case 2:
                return classifications.get(rowIndex).getQuantityvacacies();

            case 3:
                return classifications.get(rowIndex).getQuantityjobseeker();


            default:
                return null;

        }
    }

     @Override
    public String getColumnName(int iCol) {
        return columnsName[iCol];
    }

    @Override
    public Class getColumnClass(int iCol) {
        return columnsClass[iCol];
    }
}
